Solved: /rest/api/3/issue/{issue 您所在的位置:网站首页 Solved download attachment by rest api Solved: /rest/api/3/issue/{issue

Solved: /rest/api/3/issue/{issue

2024-07-08 10:06| 来源: 网络整理| 查看: 265

Hello,

I did a quick check on the API endpoint to make sure the call would go through without an issue and doing a direct Curl to the endpoint is working without triggering this behavior, so error you are encountering looks to be something in the formatting of the Unirest input values.

Testing this out I used the following CURL format with a cloud API token for basic auth:

curl -D- -u user:token -X POST -H "X-Atlassian-Token: no-check" -F "file=@中文.png" https://mydomain.atlassian.net/rest/api/3/issue/key-123/attachments

And the file uploaded correctly without converting the non-ASCII values to question marks:

Screen Shot 2019-04-30 at 11.57.53 AM.png

I did not have the maven library installed to do a full test but looking at the documentation for Unirest at the following link:

http://unirest.io/java.html

It looks like it may be the formatting for the file input string missing some parenthesis as the example is:

.field("file", new File("/tmp/file"))

Can you try modifying the script to 

.field("file",abc中文.png(in))

And if that does not work try removing the "in" variable and test with a direct syntax input to see if we can bypass the issue with something like:

HttpResponse uploadResponse = Unirest.post(imaggaAPIEndpoint).header("X-Atlassian-Token","no-check").header("Accept","application/json").basicAuth("myCount","token").field("file",abc中文.png("path/to/abc中文.png")).asJson();

Regards,Earl



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有